package com.buka.role.controller;

import com.buka.role.entity.Role;
import com.buka.role.service.RoleService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/role/list")
public class RoleList extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        RoleService roleService = new RoleService();
        List<Role> list = roleService.list();

        req.setAttribute("roleList",list);

        req.getRequestDispatcher("/role/list.jsp").forward(req,resp);

    }
}
